package com.haoshuang.zhouzhoubang.ui.adapter

import com.chad.library.adapter4.BaseQuickAdapter
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemQuestionBinding
import com.haoshuang.zhouzhoubang.model.bean.QuestionBean
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter


/**
 * 订单模块中的订单列表适配器
 * */
class QuestionAdapter(data: MutableList<QuestionBean>) :
    BaseBindingQuickAdapter<QuestionBean, ItemQuestionBinding>(data){

    override fun onBindViewHolder(holder: BaseBindingHolder, position: Int, item: QuestionBean?) {
        if (item==null){
            return
        }
        val binding = ItemQuestionBinding.bind(holder.itemView)
        binding.apply {
            tvAnswerA.text=item.desc
            when(item.title){
                "A"->{
                    if (item.is_Check!=0){
                        ivAnswerA.setImageResource(R.mipmap.icon_optioned_a)
                    }else{
                        ivAnswerA.setImageResource(R.mipmap.icon_option_a)
                    }

                }
                "B"->{
                    if (item.is_Check!=0){
                        ivAnswerA.setImageResource(R.mipmap.icon_optioned_b)
                    }else{
                        ivAnswerA.setImageResource(R.mipmap.icon_option_b)
                    }
                }
                "C"->{
                    if (item.is_Check!=0){
                        ivAnswerA.setImageResource(R.mipmap.icon_optioned_c)
                    }else{
                        ivAnswerA.setImageResource(R.mipmap.icon_option_c)
                    }
                }
                "D"->{
                    if (item.is_Check!=0){
                        ivAnswerA.setImageResource(R.mipmap.icon_optioned_d)
                    }else{
                        ivAnswerA.setImageResource(R.mipmap.icon_option_d)
                    }
                }
            }
        }
    }

}